﻿<?php
include_once dirname(__FILE__)."/../utils/config.php";
class Database{

    // Store the single instance of Database
	private static $m_pInstance;

	// Private constructor to limit object instantiation to within the class
	private function __construct() { 
       
		mysql_connect ( Config::DB_HOST,Config::DB_USER,Config::DB_PASS) or die( mysql_error ());
		mysql_select_db ( Config::DB_DATABASE ) or die( mysql_error ());
	}

	// Getter method for creating/returning the single instance of this class
	public static function getInstance()
	{
		if (!self::$m_pInstance)
		{
			self::$m_pInstance = new Database();
		}

		return self::$m_pInstance;
	}
	
	// Test function to simulate a query
	public function query($queryStr)
	{
		return mysql_query($queryStr);
	}
	
}


?>